package com.ymttest.database.sqlwapper.anlihui;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.anlihui.FeeConfig;

public class FeeConfigWrapper {

	SqlManager manager;

    public FeeConfigWrapper() {
        manager = new SqlManager("anlihui");
    }
    
    @SuppressWarnings("unchecked")
	public FeeConfig selectByPrimaryKey(Long id) {
    	
    	FeeConfig feeConfig = new FeeConfig();
    	List<FeeConfig> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.anlihui.FeeConfigMapper.selectByPrimaryKey",
                        id);
        manager.commit();
        
		if (result.size() > 0) {
			feeConfig = result.get(0);
		}
		
        return feeConfig;
    }
    
    /**
     * 
     * @param currentLevel
     * @param parentLevel
     * @param productType
     * @return
     */
    @SuppressWarnings("unchecked")
	public FeeConfig selectFeeAmountByLevelAndType(int currentLevel, int parentLevel, int productType) {
    	
    	FeeConfig feeConfig = new FeeConfig();
    	HashMap<String, Integer> map = new HashMap<>();
    	
    	map.put("currentLevel", currentLevel);
    	map.put("parentLevel", parentLevel);
    	map.put("productType", productType);
    	
    	List<FeeConfig> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.anlihui.FeeConfigMapper.selectFeeAmountByLevelAndType",
                        map);
        manager.commit();
        
		if (result.size() > 0) {
			feeConfig = result.get(0);
		}
		
        return feeConfig;
    }
    
    public static void main(String[] args) {
    	
    	FeeConfigWrapper test = new FeeConfigWrapper();
    	System.out.println(test.selectFeeAmountByLevelAndType(1, 2, 3).getFee_amount());
    }
}
